﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SHJunketingModel;
using SHJunketingBLL;
public partial class Admin_xz_addinfo : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["petmissionsid"].ToString() != null || Request.QueryString["petmissionsid"].ToString() != "")
            {
                //根据权限ID加载对象
                C_Permission cp = C_PermissionManage.GetC_PermissionByPermissionsID(int.Parse(Request.QueryString["petmissionsid"].ToString()));
                //数据填充
                this.lblID.Text = cp.PermissionsID.ToString();
                this.txtName.Text = cp.PermissionsName;
                this.txtDesc.Text = cp.PermissionsDesc;
            }
            else
            {
                Web.CommFun.Show_Msg("系统忙,请重试！", "PermissionsInfo.aspx");
            }
        }
       
    }
    //修改按钮
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["petmissionsid"].ToString() != null || Request.QueryString["petmissionsid"].ToString() != "")
        {
            if (this.txtDesc.Text.Length < 100)
            {
                C_Permission cp = new C_Permission();
                cp.PermissionsID = int.Parse(this.lblID.Text);
                cp.PermissionsName = this.txtName.Text;
                cp.PermissionsDesc = this.txtDesc.Text;
                //修改方法
                Boolean edit = C_PermissionManage.ModifyC_Permission(cp);
                if (edit)
                {
                    Web.CommFun.Show_Msg("修改成功!", "PermissionsInfo.aspx");
                }
                else
                {
                    Web.CommFun.Show_Msg("系统忙,请重试！", "PermissionsInfo.aspx");
                }
            }
            else
            {
                Web.CommFun.Show_Msg("请输入100以内的字符！");
            }
        }
        else
        {
            Web.CommFun.Show_Msg("系统忙,请重试！", "PermissionsInfo.aspx");
        }
        
    }
}
